<script lang="ts" setup>
import { computed, ref } from 'vue';

const firstName = ref('吴必达')
const lastName = ref('da')

const fullName =computed({
  get(){
    return firstName.value+' '+lastName.value
  },
  set(value){
    const names = value.split(' ')
    firstName.value = names[0]
    lastName.value = names[1]
  }

  
})
</script>

<template>
  <div>firstName:
<input type="text" v-model="firstName">
</div>
<div>lastName:
<input type="text" v-model="lastName">
</div>
<div>fullName:
<input type="text" v-model="fullName">
</div>

</template>

<style scoped></style>